package com.zzc.util;

import com.zzc.mapper.AdminUserMapper;
import com.zzc.service.AdminUserService;
import com.zzc.service.impl.AdminUserServiceImpl;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @author zhouzhicheng
 * @version 1.0  2020/12/29
 */

public class MyTest {

    public static void main(String[] args) {
        ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        /*SqlSessionFactory sqlSessionFactory = (SqlSessionFactory) app.getBean("sqlSessionFactory");
        SqlSession sqlSession = sqlSessionFactory.openSession();
        System.out.println(sqlSession);
        AdminUserMapper mapper = sqlSession.getMapper(AdminUserMapper.class);
        System.out.println(mapper.selectByPrimaryKey(1));*/
        AdminUserService service = (AdminUserService) app.getBean("adminUserService");
        System.out.println(service.selectByPrimaryKey(1));
    }
}
